﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using V = Science.Mathematics.VectorCalculus;

namespace VectorCalculus5Ed.Chapter2.Section6
{
    public class Example02
    {
        public Example02()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
        public void Compute()
        {
            V.Function.ToLastType<double[], double> f
                = new V.Function.ToLastType<double[], double>(func);
            double[] at = { 2.5, 4.5, 1.5 };
            V.Gradient delf = new V.Gradient(f, at);
            delf.Compute();
            result += delf.Result[0].ToString() + "  ";
            result += delf.Result[1].ToString() + "  ";
            result += delf.Result[2].ToString() + "\r\n";
        }
        private double func(double[] x)
        {
            return x[0] * x[1] + x[2];
        }
    }
}
// 4.50000000000017  2.50000000000047  1.00000000000235